'use strict';

const Service = require('egg').Service;
const {
    ERROR,
    SUCCESS,
} = require('../util/util');

class ConfigService extends Service {
  async selectCityConfig() {
      const { ctx, logger } = this

      try {
          const city = await ctx.model.Config.findAll()

          return Object.assign(SUCCESS(), {
            data: Object.assign(city),
          });
      } catch (error) {
        logger.error(error)
        return Object.assign(ERROR(), {
            msg: '服务器错误',
        });
      }
  }
}

module.exports = ConfigService;
